package com.jinzihan.junit;

import com.jinzihan.dao.ClassroomDao;
import com.jinzihan.dao.impl.ClassroomDaoImpl;
import com.jinzihan.entity.Classroom;
import org.junit.jupiter.api.Test;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

class ClassroomDaoImplTest {
    ClassroomDao classroomDao = new ClassroomDaoImpl();

    @Test
    void saveClassroom() {
        classroomDao.saveClassroom(new Classroom(null,"教1-111",100,0,1,0));
        classroomDao.saveClassroom(new Classroom(null,"教2-121",70,1,1,1));
        classroomDao.saveClassroom(new Classroom(null,"教5-211",200,0,0,2));
    }

    @Test
    void changeClassroomStatus() {
        classroomDao.changeClassroomStatus(4,2);
    }

    @Test
    void queryAllClassrooms() {
        List<Classroom> classrooms = classroomDao.queryAllClassrooms();
        classrooms.forEach(System.out::println);
    }

    @Test
    void updateClassroom() {
        classroomDao.updateClassroom(new Classroom(4,"教8-880",100,0,0,0));
    }

    @Test
    void queryClassroomById() {
        Classroom classroom = classroomDao.queryClassroomById(4);
        System.out.println(classroom);
    }

    @Test
    void queryForClassroomCount() {
        int count = classroomDao.queryForClassroomCount();
        System.out.println(count);
    }
}